package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "yuangong_juese", schema = "boot", catalog = "")
@IdClass(YuangongJuesePK.class)
public class YuangongJuese {
    private int empId;
    private int jueId;
    //private Role roleByJueId;


    public YuangongJuese() {
    }

    public YuangongJuese(int empId, int jueId) {
        this.empId = empId;
        this.jueId = jueId;
    }

    @Id
    @Column(name = "emp_id", nullable = false)
    public int getEmpId() {
        return empId;
    }

    public void setEmpId(int empId) {
        this.empId = empId;
    }

    @Id
    @Column(name = "jue_id", nullable = false)
    public int getJueId() {
        return jueId;
    }

    public void setJueId(int jueId) {
        this.jueId = jueId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        YuangongJuese that = (YuangongJuese) o;
        return empId == that.empId &&
                jueId == that.jueId;
    }

    @Override
    public int hashCode() {
        return Objects.hash(empId, jueId);
    }

   /* @ManyToOne
    @JoinColumn(name = "jue_id", referencedColumnName = "jue_id", nullable = false)
    public Role getRoleByJueId() {
        return roleByJueId;
    }

    public void setRoleByJueId(Role roleByJueId) {
        this.roleByJueId = roleByJueId;
    }*/
}
